# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=ruby-json-schema
_gemname=${pkgname#ruby-}
pkgver=5.0.1
pkgrel=0
pkgdesc="Ruby JSON Schema Validator"
url="https://github.com/voxpupuli/json-schema"
arch="noarch"
license="MIT"
depends="ruby ruby-addressable"
checkdepends="
	ruby-minitest
	ruby-rake
	ruby-test-unit
	"
source="https://github.com/voxpupuli/$_gemname/archive/v$pkgver/ruby-json-schema-$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"
options="!check" # missing dependency: ruby-webmock

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files.
	cd "$gemdir"
	rm -r cache/ build_info/ doc/ extensions/ plugins/

	cd "$geminstdir"
	rm -rf ./*.md

}

sha512sums="
a1fc5cf8fd26e98e70383b7f1a8d2b8a0042513dace852e095000b7010639b0ede3283a37fa0773a91c0c15062e46200bfaf760addcc8d0053776fd45c292e75  ruby-json-schema-5.0.1.tar.gz
"
